@use "sass:color";

.homepage-intro {
    margin-top: 24px;
    @include md-down {
        margin-top: 16px;
    }
}

/* Featured work */
.homepage-intro__featured-work {
    overflow-x: auto;
    @include md-down {
        margin: 0 16px 24px 16px;
        overflow-x: auto;
    }
}

.homepage-intro__featured-work-column {
    display: flex;
    flex-direction: column;
    @include md-down {
        flex-direction: row;
    }
}

.homepage-intro__featured-work-column__desktop {
    @include md-down {
        display: none;
    }
}

.homepage-intro__featured-work-column__mobile {
    display: none;
    @include md-down {
        display: flex;
        gap: 24px;
    }
}

.homepage-intro__featured-tile {
    border: 1px solid $blue-10;
    padding: 16px;
    color: $blue-90;
    align-self: start;
    margin-bottom: 24px;
    transition: border-color 0.125s;
    &:hover {
        border-color: $blue-30;
    }

    &:last-child {
        margin-bottom: 0;
    }

    &:not(:first-child) {
        @include md-up {
            .homepage-intro__featured-work-description {
                display: none;
            }
        }
    }

    @include md-down {
        width: 302px;
        height: 100%;
        &:last-child {
            margin-right: -24px;
        }
    }
}

.homepage-intro__new-tag {
    text-transform: uppercase;
    background-color: color.scale($vermillion, $alpha: -80%);
    color: $vermillion;
    padding: 2px 4px;
    border-radius: 2px;
    margin-right: 8px;
}

.homepage-intro__featured-work-kicker {
    color: $blue-60;
}

.homepage-intro__featured-work-title {
    margin-top: 0;
    margin-bottom: 4px;
}

.homepage-intro__featured-work-description {
    margin-top: 0;
    margin-bottom: 4px;
}

.homepage-intro__featured-work-authors {
    margin: 0;
    color: $blue-60;
}

/* Announcements */
.homepage-intro__announcements {
    background-color: $gray-5;
    padding: 16px;
    display: flex;
    flex-direction: column;

    @include md-down {
        padding-top: 24px;
    }
}

.homepage-intro__announcements-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px 16px;
    align-items: center;
    svg {
        height: 56px;
        flex-shrink: 0;
    }

    h4 {
        font-size: 1.25rem;
        line-height: 1.5rem;
        color: $blue-90;
        margin: 0;
        flex: 0 0 calc(100% - 56px - 16px);
    }

    @include md-down {
        align-items: center;
    }
}

.homepage-intro__announcements-list {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.homepage-intro__announcement {
    list-style: none;
    padding: 16px 0;
    border-bottom: 1px solid $blue-20;
}

.homepage-intro__announcement:last-child {
    border-bottom: none;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
    position: relative;

    &.homepage-intro__announcement--is-overflowing {
        .homepage-intro__announcement-read-more {
            opacity: 0;
        }
        &:after {
            content: "";
            pointer-events: none;
            width: 100%;
            height: 100%;
            position: absolute;
            left: 0;
            top: 0;
            background: linear-gradient(
                180deg,
                rgba(219, 229, 240, 0) 50%,
                $gray-5 100%
            );
        }
    }

    @include md-down {
        display: none;
    }
}

.homepage-intro__announcement-link {
    line-height: 1;
    display: block;
    &:hover {
        .homepage-intro__announcement-read-more {
            text-decoration: underline;
        }
    }
}

.homepage-intro__announcement-meta {
    color: $blue-50;
    margin-top: 0;
    margin-bottom: 4px;
}

.homepage-intro__announcement-title {
    color: $blue-90;
    line-height: 1.3125rem;
    margin-top: 0;
    margin-bottom: 4px;
}

.homepage-intro__excerpt {
    margin: 0;
    color: $blue-60;
}

.homepage-intro__announcement-read-more {
    color: $blue-90;
    svg {
        height: 10px;
        position: relative;
        top: -1px;
    }
}

.homepage-intro__latest-button {
    @include sm-only {
        svg {
            display: none;
        }
    }
}

.homepage-intro__subscribe-button {
    display: none;
    @include md-down {
        display: block;
        margin-top: 16px;
        svg {
            display: none;
        }
    }
}

/* Newsletter */
.homepage-intro__newsletter-signup {
    background-color: $accent-pale-blue;
    padding: 16px;
    margin-bottom: 24px;

    .newsletter-subscription-header {
        margin-bottom: 16px;
    }

    .newsletter-subscription-form {
        border-bottom: 1px solid #bdd4f7;
        padding-bottom: 16px;
    }

    .newsletter-subscription-form__subheader {
        @include body-2-regular;
        color: $blue-65;
    }

    .newsletter-subscription-form__label-frequency {
        display: inline;
        margin-left: 6px;
    }

    .newsletter-subscription-form__email-submit {
        display: flex;
        flex-direction: column;
        .newsletter-subscription-form__submit {
            margin-top: 8px;
            height: 40px;
        }
    }

    .newsletter-subscription-form__privacy-notice {
        color: $blue-65;
    }

    @include md-down {
        background-color: $gray-5;
        padding-top: 8px;
        .newsletter-subscription-header,
        .newsletter-subscription-form {
            display: none;
        }
        .owid-socials__heading {
            margin-top: 0;
        }
    }
}

/* Donation Cta */
.homepage-intro__donation-cta {
    padding: 16px;
    background-color: $accent-pale-blue;
    display: flex;
    gap: 16px;
    svg {
        color: $vermillion;
        background: $blue-20;
        padding: 16px;
        border-radius: 50%;
    }

    .homepage-intro__donation-message {
        margin: 0;
        color: $blue-65;
    }

    .homepage-intro__donation-link {
        margin: 0;
        color: $vermillion;
        text-decoration: underline;
        &:hover {
            text-decoration: none;
        }
    }

    @include md-down {
        margin: 16px;
        margin-bottom: 0;
    }
}
